home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Mania 6
/
MacMania 6.toast
/
/
Multimedia & Desktop
/
VideoToolbox
/
VideoToolboxSources
/
ATMInterface.c
< prev
next >
Wrap
Text File
|
1997-05-19
|
4KB
|
121 lines
/*
* ATMInterface.c
*
* Version 1.01
*
* Adobe Type Manager is a trademark
* of Adobe Systems Incorporated.
As provided by Adobe, ATMInterface.c only worked if compiled as 68k code. I've
enhanced it, by changing the direct calls to ATM to indirect CallUniversalProc
calls, so the Mixed Mode Manager can do its magic if this file is compiled to
run native. This works with the current 68k version of ATM (3.6.1), and will
probably also work with the forthcoming fat version of ATM (3.8?), assuming
Adobe maintains the API (Application Programming Interface). However, we will be
calling the 68k code in ATM.
This program from Adobe (Version 1.01) is quite old, but its API is still
supported by current versions of ATM (3.8.2). Newer versions of ATMInterface.c add a way to return
an error code to some of these functions, and add a whole slew of functions
for controlling SuperATM's Multiple font Master capabilities.
The current version (3.0) of ATMInterface.c can be downloaded from Adobe's website:
<ftp://ftp.mv.us.adobe.com/pub/adobe/Programs/MacATM30headers.sea.hqx>
For current documentation of the ATM Macintosh C interface download:
<ftp://ftp.mv.us.adobe.com/pub/adobe/DeveloperSupport/TechNotes/5072.ATM_Adv_Mac.pdf>
HISTORY:
93? dgp I don't remember how or when I got this. Perhaps from the Adobe section
of Compuserve.
9/7/94 dgp Introduced Universal proc pointers to allow PowerPC code to call
the current (68k) version of ATM (3.6.1).
11/15/94 dgp made compatible with pre-Universal headers.
1/5/95 dgp made compatible with Universal Headers 2.
*/
#include "ATMInterface.h"
#if defined(__powerc) && !defined(__MIXEDMODE__)
#include <MixedMode.h>
#endif
#ifndef GENERATING68K // Allow compilation without VideoToolbox.h, with old Apple headers.
#if defined(__powerc)
#ifndef GENERATING68K
#define GENERATING68K 0
#define GENERATINGPOWERPC 1
#endif
#else
#define GENERATING68K 1
#define GENERATINGPOWERPC 0
#endif
#endif
#if GENERATINGPOWERPC
enum{
uppFontAvailable=kThinkCStackBased
| RESULT_SIZE(kTwoByteCode)
| STACK_ROUTINE_PARAMETER(1,kTwoByteCode)
| STACK_ROUTINE_PARAMETER(2,kTwoByteCode)
,uppShowText=kThinkCStackBased
| RESULT_SIZE(kTwoByteCode)
| STACK_ROUTINE_PARAMETER(1,kFourByteCode)
| STACK_ROUTINE_PARAMETER(2,kTwoByteCode)
| STACK_ROUTINE_PARAMETER(3,kFourByteCode)
,uppXyshowText=kThinkCStackBased
| RESULT_SIZE(kTwoByteCode)
| STACK_ROUTINE_PARAMETER(1,kFourByteCode)
| STACK_ROUTINE_PARAMETER(2,kTwoByteCode)
| STACK_ROUTINE_PARAMETER(3,kFourByteCode)
| STACK_ROUTINE_PARAMETER(4,kFourByteCode)
};
#elif !defined(NewRoutineDescriptor)
#define NewRoutineDescriptor(theProc,theProcInfo,theISA) (theProc)
#endif
static short open=0;
static ATMProcs3 procs;
short initATM(void)
{
CntrlParam c;
if(open)return 1; // added by Denis Pelli to skip opening if already open
if(OpenDriver("\p.ATM",&c.ioCRefNum))return 0;
c.csCode = ATMProcsStatusCode;
*(ATMProcs3 **) c.csParam = &procs;
procs.version = ATMProcs3Version;
if(PBStatus((ParmBlkPtr)&c,0))return 0;
open=1;
/* replace each ProcPtr by a UniversalProcPtr. */
procs.fontAvailable=(void *)NewRoutineDescriptor((ProcPtr)procs.fontAvailable,uppFontAvailable,kM68kISA);
procs.showText=(void *)NewRoutineDescriptor((ProcPtr)procs.showText,uppShowText,kM68kISA);
procs.xyshowText=(void *)NewRoutineDescriptor((ProcPtr)procs.xyshowText,uppXyshowText,kM68kISA);
return 1;
}
short fontAvailableATM(short family,short style)
{
#if GENERATING68K
return open ? (*procs.fontAvailable)(family,style) : 0;
#else
return open ? CallUniversalProc(procs.fontAvailable,uppFontAvailable
,family,style) : 0;
#endif
}
short showTextATM(char *text,short length,FixedMatrix *matrix)
{
#if GENERATING68K
return open ? (*procs.showText)(text,length,matrix) : length;
#else
return open ? CallUniversalProc(procs.showText,uppShowText
,text,length,matrix) : length;
#endif
}
short xyshowTextATM(char *text,short length,FixedMatrix *matrix,Fixed *displacements)
{
#if GENERATING68K
return open ? (*procs.xyshowText)(text,length,matrix,displacements) : length;
#else
return open ? CallUniversalProc(procs.xyshowText,uppXyshowText
,text,length,matrix,displacements) : length;
#endif
}